from django.contrib import admin
from .models import CarRank, UserProfile

class CarRankAdmin(admin.ModelAdmin):
    list_display = ('series_id', 'series_name', 'brand_name', 'min_price', 'max_price', 'ranks', 'count')
    list_filter = ('brand_name', 'sub_brand_name')
    search_fields = ('series_name', 'brand_name')
    ordering = ('ranks',)
    list_per_page = 20

class UserProfileAdmin(admin.ModelAdmin):
    list_display = ('user', 'phone')
    search_fields = ('user__username', 'phone')

admin.site.register(CarRank, CarRankAdmin)
admin.site.register(UserProfile, UserProfileAdmin)

# 自定义管理员站点标题
admin.site.site_header = '汽车数据分析系统管理后台'
admin.site.site_title = '汽车数据分析系统'
admin.site.index_title = '管理面板'
